#include <QStringList>

#include"communication.h"

Text::Text(QString s)
{
    service =(SERVICE_CODE)s[0].digitValue();
    s.remove(0,1);
    t = s;
}

void Text::add(QString s)
{
    t += s;
    t += ",";
}

void Text::setType(SERVICE_CODE sc)
{
    service = sc;
}

SERVICE_CODE Text::getType()
{
    return service;
}

char *Text::toString()
{
    QString s;
    s += QString::number(service);
    s += t;

    char buff[1024];

    memcpy(buff,s.toLocal8Bit().data(),s.length());

    buff[s.length()] = '\0';

    return buff;
}

int Text::length()
{
    return t.length()+1;
}

QStringList Text::toStringList()
{
    //QStringList
    return t.split(",");
}
